package com.timemaneger.thinkintime.custom;

import android.content.Context;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.CheckedTextView;
import android.widget.EditText;

import com.timemaneger.thinkintime.R;

public class TempActivity extends AppCompatActivity implements View.OnClickListener{

    Button mButton1;
    Button mButton2;
    EditText mHeader;
    EditText mContent;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_temp);
        mButton1=(Button)findViewById(R.id.tempOK);
        mButton2=(Button)findViewById(R.id.tempCancel);
        mHeader = (EditText) findViewById(R.id.tempHeader);
        mContent = (EditText) findViewById(R.id.tempContent);
        mButton2.setOnClickListener(this);
        mButton1.setOnClickListener(this);
    }


    @Override
    public void onClick(View view) {
        switch (view.getId()){
            case R.id.tempOK:
                Intent intent1=new Intent();
                Event event = new Event("", mHeader.getText().toString(), mContent.getText().toString());
                intent1.putExtra("return", event);
                setResult(RESULT_OK,intent1);
                finish();
                break;
            case R.id.tempCancel:
                setResult(RESULT_CANCELED);
                finish();
                break;
                default:break;
        }
    }

    @Override
    public void onBackPressed() {
        setResult(RESULT_CANCELED);
        finish();
    }
}
